<?php
/**
 * @author shuang
 * @date 2017-1-2 23:03:59
 */
\common\widgets\DatalistWidgetsAsset::register($this);
\common\widgets\FileInputAsset::register($this);
$this->registerJsFile('/js/taskmanager.js', ['depends' => ['backend\assets\AppAsset']]);
$this->registerJs('taskmanager.init();');
$labels = array_merge($labels, [
    "username" => "商户账号",
        ]);
//添加操作提示模板
echo $this->render("/layouts/prompt", array("labels" => $labels));
?>
<div class="form-inline" role="form" id="toolbar">
    <div class="form-group">
        <input class="form-control" name="title" autocomplete="off" type="text" value="" placeholder="任务名称"/>
    </div>
    <div class="form-group">
        <input class="form-control" name="taskid" autocomplete="off" type="text" value="" placeholder="任务编号"/>
    </div>
    <div class="form-group">
        <input class="form-control" name="username" autocomplete="off" type="text" value="" placeholder="商户账号"/>
    </div>
    <div class="form-group">
        <?php echo yii\helpers\Html::dropDownList("type", null, yii\helpers\ArrayHelper::merge([-1 => "请选择任务类型"], yii\helpers\ArrayHelper::map(common\components\MTools::dictDropdown("task_type"), "id", "name")), ["class" => "selectpicker"]); ?>
    </div>
    <div class="form-group">
        <?php echo yii\helpers\Html::dropDownList("status", null, yii\helpers\ArrayHelper::merge([-1 => "请选择任务状态"], yii\helpers\ArrayHelper::map(common\components\MTools::dictDropdown("task_status_type"), "id", "name")), ["class" => "selectpicker"]); ?>
    </div>
    <button id="ok" type="submit" class="btn btn-primary">查 询</button>
    <button id="reset" type="reset" class="btn">清 空</button>
</div>
<table id="table"></table>
<div id="taskdetalmodal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="taskdetalmodal" style="display: none;">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="taskdetalmodal">任务详情</h4>
            </div>
            <div class="modal-body">
                <div data-tab-id="togglable-tabs">
                    <ul id="myTabs" class="nav nav-tabs" role="tablist">
                        <li role="presentation" class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="false">基本信息</a></li>
                        <li role="presentation"><a href="#profile" role="tab" id="profile-tab" data-toggle="tab" aria-controls="profile" aria-expanded="true">内容详情</a></li>
                        <li role="presentation" class="dropdown">
                            <a href="#" id="myTabDrop1" class="dropdown-toggle" data-toggle="dropdown" aria-controls="myTabDrop1-contents" aria-expanded="false">任务图片<span class="caret"></span></a>
                            <ul class="dropdown-menu" aria-labelledby="myTabDrop1" id="myTabDrop1-contents">
                                <li class=""><a href="#dropdown1" role="tab" id="dropdown1-tab" data-toggle="tab" aria-controls="dropdown1" aria-expanded="false">样图</a></li>
                                <li><a href="#dropdown2" role="tab" id="dropdown2-tab" data-toggle="tab" aria-controls="dropdown2" aria-expanded="false">二维码</a></li>
                            </ul>
                        </li>
                    </ul>
                    <div id="myTabContent" class="tab-content">
                        <div role="tabpanel" class="tab-pane fade active in" id="home" aria-labelledby="home-tab">
                            <div class="row">
                                <div class="col-md-4"><h4><span class="label label-default">商户账号</span></h4></div>
                                <div class="col-md-7 "><h4 id="username"></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-4"><h4><span class="label label-default">任务名称</span></h4></div>
                                <div class="col-md-7 "><h4 id="title"></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-4"><h4><span class="label label-default">任务类型</span></h4></div>
                                <div class="col-md-7 "><h4 id="typename"></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-4"><h4><span class="label label-default">任务发布价格</span></h4></div>
                                <div class="col-md-7 "><h4 id="price"></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-4"><h4><span class="label label-default">任务刷单价格</span></h4></div>
                                <div class="col-md-7 "><h4 id="brush_price"></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-4"><h4><span class="label label-default">任务总量</span></h4></div>
                                <div class="col-md-7 "><h4 id="number"></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-4"><h4><span class="label label-default">样图数量</span></h4></div>
                                <div class="col-md-7 "><h4 id="sample_figure_count"></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-4"><h4><span class="label label-default">是否提供账号或手机账号</span></h4></div>
                                <div class="col-md-7 "><h4 id="is_offer_mobile"></h4></div>
                            </div>

                        </div>
                        <div role="tabpanel" class="tab-pane fade" id="profile" aria-labelledby="profile-tab">
                            <div class="row">
                                <div class="col-md-2"><h4><span class="label label-default">任务简介</span></h4></div>
                                <div class="col-md-7 "><h4><p id="note"></p></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-2"><h4><span class="label label-default">投票地址</span></h4></div>
                                <div class="col-md-7 "><h4><p id="vote_address" style="word-wrap:break-word;"></p></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-2"><h4><span class="label label-default">备注</span></h4></div>
                                <div class="col-md-7 "><h4><p id="description"></p></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-2"><h4><span class="label label-default">注意事项</span></h4></div>
                                <div class="col-md-7 "><h4><p id="considerations"></p></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-2"><h4><span class="label label-default">任务步骤1</span></h4></div>
                                <div class="col-md-7 "><h4><p id="step_01"></p></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-2"><h4><span class="label label-default">任务步骤2</span></h4></div>
                                <div class="col-md-7 "><h4><p id="step_02"></p></h4></div>
                            </div>
                            <div class="row">
                                <div class="col-md-2"><h4><span class="label label-default">任务步骤完成</span></h4></div>
                                <div class="col-md-7 "><h4><p id="step_03"></p></h4></div>
                            </div>
                        </div>
                        <div role="tabpanel" class="tab-pane fade" id="dropdown1" aria-labelledby="dropdown1-tab">
                            <h4><p><img src="" id="sample_figure" width="300" height="300"/></p></h4>
                        </div>
                        <div role="tabpanel" class="tab-pane fade" id="dropdown2" aria-labelledby="dropdown2-tab">
                            <h4><p><img src="" id="qrcode" width="300" height="300"/></p></h4>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary pull-left" id="toptask" data-dismiss="modal">置顶</button>
                <button type="button" class="btn btn-info pull-left" id="edittask" data-dismiss="modal">编辑</button>
                <button type="button" class="btn btn-danger pull-left" id="reflashtask" data-dismiss="modal">刷新</button>
                <button type="button" class="btn btn-warning pull-left" id="addtask" data-dismiss="modal">追加任务</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<div id="taskdetalmodal-toptask" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="taskdetalmodal-toptask" style="display: none;">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="taskdetalmodal-toptask">任务置顶</h4>
            </div>
            <div class="modal-body form-horizontal">
                <div class="panel-body panel-body-nopadding">
                    <input name="hidid" id="hidid" value="" type="hidden">
                    <div class="row">
                        <div class="col-md-4"><h4><span class="label label-default">任务名称标题</span></h4></div>
                        <div class="col-md-8 "><h4><p id="title"></p></h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-4"><h4><span class="label label-default">详情</span></h4></div>
                        <div class="col-md-8">
                            <h4>
                                <p>公众号：<span id='publicode' style="word-wrap:break-word;"></span></p>
                                <p>投票链接：<span id='vote_address' style="word-wrap:break-word;"></span></p>
                                <p>描述：<span id='description' style="word-wrap:break-word;"></span></p>
                            </h4>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-4"><h4><span class="label label-default">置顶价格(12小时)</span></h4></div>
                        <div class="col-md-8 "><h4>10  元 （设置置顶后12小时内会一直排在任务最前面直到任务结束，投手会首先做你的任务，位置有限，如果置顶不成功稍等再试，<span style="color: red">非投票任务禁止置顶</span>）</h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-4"><h4><span class="label label-default">位置</span></h4></div>
                        <div class="col-md-8 "><h4>空余<span id='tasktopcount'></span>个位置</h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-4"><h4><span class="label label-default">是否扣款</span></h4></div>
                        <div class="col-md-8 "><h4><input  type="radio" name="isdedu" value="1" checked="checked"/><span style="padding:0 10px 0 3px;">是</span><input  type="radio" name="isdedu" value="0" /><span style="padding:0 10px 0 3px;">否</span></h4></div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary btn-toptask">确定</button>
            </div>
        </div>
    </div>
</div>
<div id="taskdetalmodal-addtask" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="taskdetalmodal-addtask" style="display: none;">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="taskdetalmodal-addtask">追加任务</h4>
            </div>
            <div class="modal-body form-horizontal">
                <div class="panel-body panel-body-nopadding">
                    <input name="hidid" id="hidid" value="" type="hidden">
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">任务名称标题</span></h4></div>
                        <div class="col-md-7 "><h4><p id="title"></p></h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">详情</span></h4></div>
                        <div class="col-md-7">
                            <h4>
                                <p>公众号：<span id='publicode' style="word-wrap:break-word;"></span></p>
                                <p>投票链接：<span id='vote_address' style="word-wrap:break-word;"></span></p>
                                <p>描述：<span id='description' style="word-wrap:break-word;"></span></p>
                            </h4>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">单价</span></h4></div>
                        <div class="col-md-7 "><h4 id='price'></h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">追加数量</span></h4></div>
                        <div class="col-md-7 "><h4><input id="number" class="form-control" name="number" autocomplete="off" type="text" value="" placeholder="如不需要追加填写0即可"/></h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">终止时间（选填）</span></h4></div>
                        <div class="col-md-7 "><h4><input id="endtime" class="form-control" name="end_at" autocomplete="off" type="text" value="" placeholder=""/></h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-4"><h4><span class="label label-default">是否扣款</span></h4></div>
                        <div class="col-md-8 "><h4><input  type="radio" name="isdedu" value="1" checked="checked"/><span style="padding:0 10px 0 3px;">是</span><input  type="radio" name="isdedu" value="0" /><span style="padding:0 10px 0 3px;">否</span></h4></div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary btn-addtask">确定</button>
            </div>
        </div>
    </div>
</div>
<div id="taskdetalmodal-reflashtask" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="taskdetalmodal-reflashtask" style="display: none;">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="taskdetalmodal-reflashtask">刷新任务</h4>
            </div>
            <div class="modal-body form-horizontal">
                <div class="panel-body panel-body-nopadding">
                    <input name="hidid" id="hidid" value="" type="hidden">
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">任务名称标题</span></h4></div>
                        <div class="col-md-7 "><h4><p id="title"></p></h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">详情</span></h4></div>
                        <div class="col-md-7">
                            <h4>
                                <h4>
                                    <p>公众号：<span id='publicode' style="word-wrap:break-word;"></span></p>
                                    <p>投票链接：<span id='vote_address' style="word-wrap:break-word;"></span></p>
                                    <p>描述：<span id='description' style="word-wrap:break-word;"></span></p>
                                </h4>
                            </h4>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">刷新价格(单次)</span></h4></div>
                        <div class="col-md-7 "><h4>2元</h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">连续次数</span></h4></div>
                        <div class="col-md-7 "><h4><input id="reflashNO" class="form-control" name="reflashNO" autocomplete="off" type="text" value="" placeholder="自动刷新任务的次数,刷新间隔为1小时"/></h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-4"><h4><span class="label label-default">是否扣款</span></h4></div>
                        <div class="col-md-8 "><h4><input  type="radio" name="isdedu" value="1" checked="checked"/><span style="padding:0 10px 0 3px;">是</span><input  type="radio" name="isdedu" value="0" /><span style="padding:0 10px 0 3px;">否</span></h4></div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary btn-reflashtask">确定</button>
            </div>
        </div>
    </div>
</div>
<div id="taskdetalmodal-edittask" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="taskdetalmodal-edittask" style="display: none;">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="taskdetalmodal-edittask">编辑任务</h4>
            </div>
            <div class="modal-body form-horizontal"><form action='/merchant/edittask.html' method='post' id='editform' enctype="multipart/form-data">
                    <div class="panel-body panel-body-nopadding">
                        <input type='hidden' name='id' value='' id='id'/>
                        <div class="row">
                            <div class="col-md-3"><h4><span class="label label-default">任务类型</span></h4></div>
                            <div class="col-md-7"><h4 id='typename'></h4></div>
                        </div>
                        <div class="row">
                            <div class="col-md-3"><h4><span class="label label-default">任务单价</span></h4></div>
                            <div class="col-md-7 "><h4 id='price'></h4></div>
                        </div>
                        <div class="row">
                            <div class="col-md-3"><h4><span class="label label-default">任务名称</span></h4></div>
                            <div class="col-md-7 "><h4><input id="title" class="form-control" name="title" autocomplete="off" type="text" value="" /></h4></div>
                        </div>
                        <div class="row">
                            <div class="col-md-3"><h4><span class="label label-default">投票地址</span></h4></div>
                            <div class="col-md-7 "><h4><input id="vote_address" class="form-control" name="vote_address" autocomplete="off" type="text" value="" /></h4></div>
                        </div>
                        <div class="row">
                            <div class="col-md-3"><h4><span class="label label-default">简介</span></h4></div>
                            <div class="col-md-7 "><h4><textarea class="form-control" id="note" name="note" rows="7" placeholder=""></textarea></h4></div>
                    </div>
                    <div class="row">
                                <div class="col-md-3"><h4><span class="label label-default">样图数量</span></h4></div>
                                <div class="col-md-7 "><h4><input id="sample_figure_count" class="form-control" name="sample_figure_count" autocomplete="off" type="text" value="" /></h4></div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">样图</span></h4></div>
                        <div class="col-md-7 ">
                                <div class="controls">
                                    <input id="qrpickfiles" name="WB_Task[sample_figure]" type="file" multiple class="btn btn-success" />
                                </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">二维码</span></h4></div>
                        <div class="col-md-7 ">
                                <div class="controls">
                                    <input id="qrpickfilesqrcode" name="WB_Task[qrcode]" type="file" multiple class="btn btn-success">
                                </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">备注</span></h4></div>
                        <div class="col-md-7 "><h4><textarea class="form-control" id="description" name="description" rows="7" placeholder="仅发布者可见，便于做记录。"></textarea></h4></div>
                    </div>
                        <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">注意事项</span></h4></div>
                        <div class="col-md-7 "><h4><textarea class="form-control" id="considerations" name="considerations" rows="7" placeholder=""></textarea></h4></div>
                    </div>
                        <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">任务步骤1</span></h4></div>
                        <div class="col-md-7 "><h4><textarea class="form-control" id="step_01" name="step_01" rows="7" placeholder=""></textarea></h4></div>
                    </div>
                        <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">任务步骤2</span></h4></div>
                        <div class="col-md-7 "><h4><textarea class="form-control" id="step_02" name="step_02" rows="7" placeholder=""></textarea></h4></div>
                    </div>
                        <div class="row">
                        <div class="col-md-3"><h4><span class="label label-default">任务步骤完成</span></h4></div>
                        <div class="col-md-7 "><h4><textarea class="form-control" id="step_03" name="step_03" rows="7" placeholder=""></textarea></h4></div>
                    </div> 
                </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary btn-edittask">确定</button>
            </div>
        </div>
    </div>
</div>
<div id="taskdetalmodal-stoptask" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="taskdetalmodal-stoptask" style="display: none;">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="taskdetalmodal-stoptask">终止任务</h4>
            </div>
            <div class="modal-body form-horizontal">
                <div class="panel-body panel-body-nopadding">
                    <input name="taskid" id="taskid" value="" type="hidden">
                    <div class="row">
                        <div class="col-md-12 "><h4><input  type="radio" name="stopcashback" value="1" /><span style="padding:0 10px 0 3px;">终止任务，按时返现</span><input  type="radio" name="stopcashback" value="2" /><span style="padding:0 10px 0 3px;">终止任务，不返现</span><input  type="radio" name="stopcashback" value="3" /><span style="padding:0 10px 0 3px;">终止任务，立即返现</span></h4></div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary btn-stoptask">确定</button>
            </div>
        </div>
    </div>
</div>